<?php namespace Common\Model;
use Hdphp\Model\Model;
class Type extends Model{
	//指定表名
	protected $table="type";
	//自动验证
	protected $vaildate=array(
		array('tname','required','类型名不能为空',3,3)
	);
	//执行添加
	public function store(){
		if(!$this->create()) return FALSE;
		$typeArr=explode('|', Q('post.tname'));
		foreach($typeArr as $tname){
			$this->add(['tname'=>$tname]);
		}
		return TRUE;
	}
	//编辑
	public function edit(){
		if(!$this->create()) return FALSE;
		$this->save();
		return TRUE;
	}
	
}

 ?>